﻿/* Problem 3 – Poker
Mitko is a famous poker player. But he is not a good developer. One day he found interesting 5-card poker game which is played by a deck of 52 cards. Nothing strange here, except that the cards have no suit (color). Mitko decided to start playing this game, but he needs a program to show him the best hand that he has. Write а program to help Mitko. The program should read the cards and check each of the following conditions and display one of the messages:
• If the five cards are equal, the program outputs “Impossible”, otherwise:
• if four of them are equal, the program outputs “Four of a Kind”, otherwise:
• if there are three equal and the another two are also equal (example: ‘2’, ‘2’, ‘10’, ‘10’, ‘2’), the program outputs “Full House”, otherwise:
• if the five are consecutive (example: ‘2’, ‘3’, ‘4’, ‘5’, ‘6’), the program outputs “Straight”, otherwise:
• if three of them are equal, the program outputs “Three of a Kind”, otherwise:
• if two pairs contain respectively equal numbers (example ‘A’, ‘K’, ‘A’, ‘K’, ‘J’), the program outputs “Two Pairs”, otherwise:
• if only two cards are equal, the program outputs “One Pair”, otherwise;
• the program outputs “Nothing”.
Cards are given with one of the following strings ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘10’, ‘J’, ‘Q’, ‘K’ or ‘A’ (without the quotes). The combination of ‘10’, ‘J’, ‘Q’, ‘K’ and ‘A’ are considered as a consecutive cards. Note that ‘A’, ‘2’, ‘3’, ‘4’ and ‘5’ are also consecutive cards so your program should output “Straight” in this case.
Input
The input data should be read from the console.
You will be given exactly 5 lines with one card per line.
The input data will always be valid and in the format described. There is no need to check it explicitly.
Output
The output data should be printed on the console.
The standard output has to display an appropriate message with the exact letters case.
Constraints
•	Allowed working time for your program: 0.1 seconds. Allowed memory: 16 MB.
Examples
Example
input	Example
output
2
7 
A
J
K	Nothing

Example
input	Example
output
4
2
A
3
5	Straight

Example
input	Example
output
8
J
J
8
8	Full House
 */

using System;

class Poker
{
    static void Main()
    {

        string card;
        int[] cardsInt = new int[5];

        

        for (int i = 0; i < 5; i++)
        {
            card = Console.ReadLine();
            switch (card)
            {
                case "J":
                    card = "11";
                    break;
                case "Q":
                    card = "12";
                    break;
                case "K":
                    card = "13";
                    break;
                case "A":
                    card = "14";
                    break;
                default:
                    break;
            }
            cardsInt[i] = int.Parse(card);
        }

        int counter = 0;
        int sum = 0;
        int flag = 0;

        for (int i = 0; i < 5; i++)
        { 
            sum += cardsInt[i];                             //the sum for straight will always sum%5=0 or 28 for A,2,3,4,5
            for (int j = (i+1); j < 5; j++)
            {
               
                if (cardsInt[i]==cardsInt[j])
                {
                    counter++;                              //counter for the switch
                    
                }
                if (cardsInt[i] != cardsInt[j])
                {
                    flag++;                                 //make sure 5 cards are different
                }
            }
        }

        if (flag == 10 && ((sum % 5 == 0) || sum == 28))
        {
            Console.WriteLine("Straight");
        }
        else
        {

            switch (counter)
            {
                case 0: 
                    Console.WriteLine("Nothing");
                    break;
                case 1:
                    Console.WriteLine("One Pair");
                    break;
                case 2:
                    Console.WriteLine("Two Pairs");
                    break;
                case 3:
                    Console.WriteLine("Three of a Kind");
                    break;
                case 4:
                    Console.WriteLine("Full House");
                    break;
                case 6:
                    Console.WriteLine("Four of a Kind");
                    break;
                case 10:
                    Console.WriteLine("Impossible");
                    break;
                default:
                    Console.WriteLine("Nothing");
                    break;
              }
         }
    }
}